package com.heima.feigns;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.heima.config.HeimaFeignAutoConfiguration;
import com.heima.feigns.fallback.ArticleFeignFallback;
import com.heima.model.article.pojos.ApArticle;
import com.heima.model.article.pojos.ApAuthor;
import com.heima.model.common.dtos.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(
        value = "leadnews-article",
        fallbackFactory = ArticleFeignFallback.class,
        configuration = HeimaFeignAutoConfiguration.class
)
public interface ArticleFegin {

    //根据用户id查询作者信息
    @GetMapping("/api/v1/author/findByUserId/{id}")
    public ResponseResult<ApAuthor> findByUserId(@PathVariable Integer id);

    //保存作者
    @PostMapping("/api/v1/author/save")
    public ResponseResult<ApAuthor> saveApAuthor(@RequestBody ApAuthor apAuthor);

    // 根据文章信息查询文章
    @PostMapping("/api/v1/article/findById/{articleId}")
    public ResponseResult<ApArticle> findByArticleId(@RequestParam("articleId") Long articleId );
}
